package day4;

/**
 * ClassName：TestString
 *
 * @Author：小鱼
 * @Create：2025-08-07 14:31
 */
public class TestString {
    public static void main(String[] args) {
        String s1 = new String("123");
        System.out.println(s1);
        s1 = "345";
        System.out.println(s1);

        //无参构造
        String s2 = new String();
        s2 = "789";
        System.out.println(s2);

        char[] c ={'a','b'};
        String s3 = new String(c);
        System.out.println(s3);


        String s4 = "a";
        String s5 = "b";
        String s6 = "ab";
        String s7 = "a"+"b";
        String s8 = s4+s5;
        System.out.println(s6==s7);//true
        System.out.println(s6==s8);//false

        String s9 = (s4+s5).intern();
        System.out.println(s9==s6);//true
    }

}
